package vistas;

import java.awt.CardLayout;


public class vista_Principal extends javax.swing.JFrame {
    public String IP_PP;
    public String IP_RE;
    PInicio pantalla_inicial;
    public vista_Principal() {
        initComponents();
        pantalla_inicial=new PInicio();
        jPanel1.add(pantalla_inicial,"Inicio");
        
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem_RE = new javax.swing.JMenuItem();
        jMenuItem_RegistroREPP = new javax.swing.JMenuItem();
        jMenuItem_RegistroPP = new javax.swing.JMenuItem();
        jMenuItem_DesinPP = new javax.swing.JMenuItem();
        Menu_CargaMasiva = new javax.swing.JMenuItem();
        jMenuItemSalir = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel1.setMaximumSize(new java.awt.Dimension(433, 291));
        jPanel1.setMinimumSize(new java.awt.Dimension(433, 291));
        jPanel1.setPreferredSize(new java.awt.Dimension(433, 291));
        jPanel1.setLayout(new java.awt.CardLayout());

        jMenu1.setText("Operaciones Lab1");

        jMenuItem_RE.setText("Registrar RE");
        jMenuItem_RE.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem_REActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem_RE);

        jMenuItem_RegistroREPP.setText("Registrar RE-PP");
        jMenuItem_RegistroREPP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem_RegistroREPPActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem_RegistroREPP);

        jMenuItem_RegistroPP.setText("Inscribir PP");
        jMenuItem_RegistroPP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem_RegistroPPActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem_RegistroPP);

        jMenuItem_DesinPP.setText("Desinscribir PP");
        jMenuItem_DesinPP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem_DesinPPActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem_DesinPP);

        Menu_CargaMasiva.setText("Carga Masiva");
        Menu_CargaMasiva.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Menu_CargaMasivaActionPerformed(evt);
            }
        });
        jMenu1.add(Menu_CargaMasiva);

        jMenuItemSalir.setText("Salir");
        jMenuItemSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemSalirActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItemSalir);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Operaciones Lab3");

        jMenuItem1.setText("Votación Primaria");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem1);

        jMenuItem2.setText("Votación Final");
        jMenu2.add(jMenuItem2);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    
private void Menu_CargaMasivaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Menu_CargaMasivaActionPerformed
       
  
       IP_PP=this.pantalla_inicial.getIP_PP();
       IP_RE= this.pantalla_inicial.getIP_RE();
       jPanel1.add(new PCargaMasiva(IP_PP,IP_RE),"Carga Masiva");
       CardLayout cl = (CardLayout)(jPanel1.getLayout());
       cl.show(jPanel1,"Carga Masiva");
}//GEN-LAST:event_Menu_CargaMasivaActionPerformed

private void jMenuItem_REActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem_REActionPerformed
          IP_PP=this.pantalla_inicial.getIP_PP();
       IP_RE= this.pantalla_inicial.getIP_RE();
        jPanel1.add(new PregRE(IP_RE),"RegistroRE");
        CardLayout cl = (CardLayout)(jPanel1.getLayout());
        cl.show(jPanel1,"RegistroRE");
}//GEN-LAST:event_jMenuItem_REActionPerformed

private void jMenuItem_RegistroREPPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem_RegistroREPPActionPerformed
          IP_PP=this.pantalla_inicial.getIP_PP();
          IP_RE= this.pantalla_inicial.getIP_RE();
         System.out.println(IP_PP + IP_RE);
       jPanel1.add(new PregREPP(IP_PP,IP_RE),"RegistroREPP");
       CardLayout cl = (CardLayout)(jPanel1.getLayout());
       cl.show(jPanel1,"RegistroREPP");
}//GEN-LAST:event_jMenuItem_RegistroREPPActionPerformed
  
private void jMenuItem_RegistroPPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem_RegistroPPActionPerformed
          IP_PP=this.pantalla_inicial.getIP_PP();
       IP_RE= this.pantalla_inicial.getIP_RE();
       jPanel1.add(new PregPP(IP_PP),"RegistroPP");
       CardLayout cl = (CardLayout)(jPanel1.getLayout());
       cl.show(jPanel1,"RegistroPP");
}//GEN-LAST:event_jMenuItem_RegistroPPActionPerformed

private void jMenuItem_DesinPPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem_DesinPPActionPerformed
         IP_PP=this.pantalla_inicial.getIP_PP();
       IP_RE= this.pantalla_inicial.getIP_RE();
       jPanel1.add(new PdesPP(IP_PP),"DescrinscribirPP");
       CardLayout cl = (CardLayout)(jPanel1.getLayout());
       cl.show(jPanel1,"DescrinscribirPP");
}//GEN-LAST:event_jMenuItem_DesinPPActionPerformed

private void jMenuItemSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemSalirActionPerformed
     this.dispose();
}//GEN-LAST:event_jMenuItemSalirActionPerformed

private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
          IP_PP=this.pantalla_inicial.getIP_PP();
       IP_RE= this.pantalla_inicial.getIP_RE();
       jPanel1.add(new votacionPrimaria(IP_RE,IP_PP),"votacionPrimaria");
       CardLayout cl = (CardLayout)(jPanel1.getLayout());
       cl.show(jPanel1,"votacionPrimaria");  
    
}//GEN-LAST:event_jMenuItem1ActionPerformed

 
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem Menu_CargaMasiva;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItemSalir;
    private javax.swing.JMenuItem jMenuItem_DesinPP;
    private javax.swing.JMenuItem jMenuItem_RE;
    private javax.swing.JMenuItem jMenuItem_RegistroPP;
    private javax.swing.JMenuItem jMenuItem_RegistroREPP;
    private javax.swing.JPanel jPanel1;
    // End of variables declaration//GEN-END:variables
}
